package cn.flant.exec.concurrent;

import java.util.HashMap;
import java.util.Map;

public abstract class Request {
	private static long requestCount;

	private static synchronized long generateRequestId() {
		return ++requestCount;
	}

	private long requestId = generateRequestId();
	private Map<String, Object> paramsMap = new HashMap<String, Object>();

	public long getRequestId() {
		return requestId;
	}

	protected abstract Object getRequestKey();

	public Object putParameter(String key, Object obj) {
		return paramsMap.put(key, obj);
	}

	public Object getParameter(String key) {
		return paramsMap.get(key);
	}

	public Object removeParameter(String key) {
		return paramsMap.remove(key);
	}
}
